package org.xx.Iterator;

import java.util.List;

public class StudentClass implements Aggregate{

    private List<Student> studentList;

    private int last;

    public StudentClass(List<Student> studentList) {
        this.studentList = studentList;
        this.last = studentList.size();
    }


    public int getLength() {
        return last;
    }

    public Student get(int index) {
        return studentList.get(index);
    }

    public void add(Student student) {
        studentList.add(student);
        last++;
    }

    @Override
    public Iterator iterator() {
        return new StudentIterator(this);
    }
}
